<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <ul>
      <!-- 要循环谁就在谁身上增加v-for属性 in 和 of 都可以 -->
      <!-- 默认是value of 数组 / （value,index） of 数组 -->
      <li v-for="(fruit,index) in fruits">
        {{fruit.name}} {{index +1}}
      </li>
    </ul>
  <p></p>
  <ul>
    <!-- 二维数组循环 -->
    <li v-for="(fruit,index) in fruits2">
      {{index+1}}. {{fruit.name}}
      <ul>
          <li v-for="(color,cindex) in fruit.color">
            {{index+1}}.{{cindex+1}} {{color}}
          </li>
      </ul>
    </li>
  </ul>
  <p></p>
  <div v-for="c in 'aaa'">{{c}}</div>
  <p></p>
  <div v-for="c in 10">{{c}}</div>
  <p></p>
  <div v-for="(value,key,index) in obj">{{key}}:{{value}} : {{index}}</div>
</div>

</body>
<script src="../node_modules/vue/dist/vue.js"></script>
<script>
    // vue 提供v-for 解决循环问题 更高效 会复用原有结构
   let vm =  new Vue({
        el: '#app',
            data:{
                obj:{name:'aaa',age:9,address:'xxxx'},
               fruits:[{name:'香蕉'},{name:'苹果'},{name:'西瓜'}],
              fruits2:[{name:'香蕉',color:['绿色','黄色']},
                        {name:'苹果',color:['红色','黄色']},
                      {name:'西瓜',color:['绿色','粉色']}]
            }
    })

</script>
</html>
